import {Button} from "antd";
import {useState} from "react";

function child(props) {
    let ag = props.info.age
    const [obj, setObj] = useState(ag)
    console.log(obj)

    function edit() {
        setObj(20)
    }
function editParent(){
        props.getChild('33')
}
    return (
        <>
            我是自组件：{obj}
            <Button onClick={edit}>修改传过来的值</Button>
            <Button onClick={editParent}>修改父组件的值</Button>
        </>
    )
}

export default child
